/**
 * @author ghp
 * @date 2023/6/6
 * @title
 * @description
 */
public class Main {
    public static void main(String[] args) {
        Solution solution = new Solution();
//        int i = solution.longestValidParentheses("((()))()()(()(");
//        int i = solution.longestValidParentheses("(()");
//        int i = solution.longestValidParentheses("(()()()");
//        int i = solution.longestValidParentheses(")(");
        int i = solution.longestValidParentheses("()()");
        System.out.println(i);
//        String str = "((()))()()(()(";
//        int index = 0;
//        while (index != -1) {
//            index = str.indexOf("()", index + 1);
//            System.out.println(index);
//        }
    }
}
